<?php
if ( ! defined('ROOT')) exit('No direct script access allowed');

/**
 * 系统控制器
 * @author gzute
 * @link http://www.gzute.com
 */

class InterfaceApp{
	
	private static $instance;
	private static $session;
	private static $input;
	
	public function __construct()
	{
		self::$instance =& $this;
		self::$session = Base::load_sys_class('session');
		self::$input = Base::load_sys_class('input');
	}
	
	public static function &get_instance()
	{
		return self::$instance;
	}
	
	
	
	/**
	 * 获取GET数据
	 */
	public static function get($item = NULL, $xss_clean = FALSE)
	{
		return self::$input->get($item, $xss_clean);
	}
	
	/**
	 * 获取POST数据
	 */
	public static function post($item = NULL, $xss_clean = FALSE)
	{
		return self::$input->post($item, $xss_clean);
	}
	
	/**
	 * 获取session对象
	 * 
	 * @param unknown_type $item
	 */
	public static function get_session($item = '')
	{
		if(empty($item) || $item == '')
		{
			return '';
		}
		return self::$session->userdata($item);
	}
	
	/**
	 * 设置session对象
	 * Enter description here ...
	 * @param unknown_type $item
	 * @param unknown_type $value
	 */
	public static function set_session($item = '', $value = '')
	{
		if(empty($item) || $item == '')
		{
			return FALSE;
		}
		self::$session->set_userdata($item, $value);
	}
	
	/**
	 * 删除所有session
	 */
	public static function session_destroy()
	{
		return self::$session->sess_destroy();
	}
	
}

//end of this file